package br.com.pucrs.aa;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class PropertiesLoader {

	private Properties props;
	private String nomeDoProperties = "configuracao.properties";
	
	public static final String ENVIRIONMENT = "ENVIRIONMENT";
	public static final String TRAFFIC_INTENSITY = "TRAFFIC_INTENSITY";

	public PropertiesLoader() {
		this.props = new Properties();
		InputStream in = this.getClass().getResourceAsStream(this.nomeDoProperties);
		try {
			props.load(in);
			in.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public String getValor(String chave) {
		return (String) props.getProperty(chave);
	}
	
	public Integer getEnvironment() {
		return Integer.parseInt(props.getProperty(ENVIRIONMENT));
	}
	
	public TrafficIntensity getTrafficIntensity() {
		return TrafficIntensity.valueOf(props.getProperty(TRAFFIC_INTENSITY).toUpperCase());
	}
}
